/* GUI CONVERTED from cscscpa.p (converter v1.76) Tue Apr 23 11:41:34 2002 */
/* cscscpa.p - Huntkey COST SET TO COST SET COPY                              */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.13.1.8 $                                                           */
/*V8:ConvertMode=Report                                                      */
/*J06D* *F0PN* was V 8 Convert Mode = FullGUIReport                           */
/* REVISION: 7.0     LAST MODIFIED: 08/28/91    BY: pma *F003**/
/* REVISION: 7.3     LAST MODIFIED: 02/18/93    BY: pma *G032**/
/* REVISION: 7.3     LAST MODIFIED: 06/15/93    BY: pma *GC06**/
/* REVISION: 8.5     LAST MODIFIED: 10/18/94    BY: mwd *J034**/
/* REVISION: 7.0     LAST MODIFIED: 10/28/94    BY: ais *FS49**/
/* REVISION: 7.4     LAST MODIFIED: 01/03/95    BY: ame *F0CJ**/
/* REVISION: 8.5     LAST MODIFIED: 08/04/95    BY: srk *J06D**/
/* REVISION: 8.6E    LAST MODIFIED: 02/23/98    BY: *L007* A. Rahane          */
/* REVISION: 8.6E    LAST MODIFIED: 03/10/98    BY: *J29Z* Kawal Batra        */
/* REVISION: 8.6E    LAST MODIFIED: 05/20/98    BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E    LAST MODIFIED: 06/04/98    BY: *K1RK* Mohan CK           */
/* REVISION: 8.6E    LAST MODIFIED: 07/16/98    BY: *J2RT* Niranjan R.        */
/* REVISION: 8.6E    LAST MODIFIED: 10/30/98    BY: *J332* Thomas Fernandes   */
/* REVISION: 9.1     LAST MODIFIED: 03/24/00    BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1     LAST MODIFIED: 08/08/00    BY: *M0QW* Falguni D.         */
/* REVISION: 9.1     LAST MODIFIED: 09/04/00    BY: *N0RC* Mark Brown         */
/* REVISION: 9.1     LAST MODIFIED: 08/23/00    BY: *N0MW* Mudit Mehta        */
/* Revision: 1.13.1.7  BY: Hiral Kadakia  DATE: 07/31/01   ECO: *N10Y*      */
/* $Revision: 1.13.1.8 $      BY: Samir Bavkar  DATE: 04/05/02   ECO: *P000*      */
/* $Revision: huntkey 01 $      BY: zyf     DATE: 05/25/04   ECO: *P000*      */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/



/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

/*J034*/ {mfdtitle.i "C+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE cscscpa_p_2 "Copy Subcontract Cost"
/* MaxLen: Comment: */

&SCOPED-DEFINE cscscpa_p_3 "Copy Labor Cost"
/* MaxLen: Comment: */

&SCOPED-DEFINE cscscpa_p_5 "Copy Material Cost"
/* MaxLen: Comment: */

&SCOPED-DEFINE cscscpa_p_6 "Copy Overhead Cost"
/* MaxLen: Comment: */

&SCOPED-DEFINE cscscpa_p_7 "Copy Burden Cost"
/* MaxLen: Comment: */

&SCOPED-DEFINE cscscpa_p_8 "From"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/* define shared variable transtype as character. */
define new shared variable transtype as character format "x(4)".
define new shared variable part  like sct_part.
define new shared variable part1 like sct_part.
define new shared variable line  like pt_prod_line.
define new shared variable line1 like pt_prod_line.
define new shared variable type  like pt_part_type.
define new shared variable type1 like pt_part_type.
define new shared variable clss  like pt_abc.
define new shared variable clss1 like pt_abc.
define new shared variable pmcd  like pt_pm_code.
define new shared variable pmcd1 like pt_pm_code.
define new shared variable ptgp  like pt_group.
define new shared variable ptgp1 like pt_group.
define new shared variable ptby  like pt_buyer.
define new shared variable ptby1 like pt_buyer.
define new shared variable site  like si_site label {&cscscpa_p_8}.
define new shared variable site1 like si_site.
define new shared variable toset like sct_sim.
define new shared variable fromset like sct_sim.
define new shared variable postol as decimal format ">>>9.9%".
define new shared variable negtol as decimal format ">9.9%".
define new shared variable mtl_flag like mfc_logical initial YES label {&cscscpa_p_5}.
define new shared variable lbr_flag like mfc_logical initial yes label {&cscscpa_p_3}.
define new shared variable bdn_flag like mfc_logical initial yes label {&cscscpa_p_7}.
define new shared variable ovh_flag like mfc_logical initial yes label {&cscscpa_p_6}.
define new shared variable sub_flag like mfc_logical initial yes label {&cscscpa_p_2}.

define variable usr_val           as character format "x(12)" extent 5.
define variable usr_elm           like sc_element extent 5.
define variable i                 as integer.
define variable disp-msg          as character no-undo format "x(20)".
define variable disp-site         as character no-undo format "x(8)" extent 2.
define variable disp-cost-set     as character no-undo format "x(11)" extent 2.
define variable disp-pct-change-allowed as character no-undo format "x(21)".
define variable disp-to-col             as character no-undo format "x(10)".
define variable backupset         as character no-undo format "x(20)".

transtype = "PP01".

{gpglefdf.i}    /* DECLARATIONS FOR gpglef.i   */

for each lngd_det
      fields(lngd_dataset lngd_field lngd_key1 lngd_key2
      lngd_key3 lngd_key4 lngd_lang lngd_translation)
   no-lock where lngd_dataset = "sc_mstr"
      and   lngd_key1    = ""
      and   lngd_key2    = ""
      and   lngd_key3    = ""
      and   lngd_field   = "sc_category"
      and   lngd_lang    = global_user_lang:
   assign
      usr_val[integer(lngd_key4)] = lngd_translation
      usr_elm[integer(lngd_key4)] = substring(lngd_translation,1,8).
end.

assign
   disp-msg                = "'" + getTermLabel("TO_COST_SET",18) + "'"
   disp-site               = getTermLabel("SITE",8)
   disp-cost-set           = getTermLabel("COST_SET",11)
   disp-pct-change-allowed = getTermLabelRt("PERCENT_CHANGE_ALLOWED",19) + ":-"
   disp-to-col             = getTermLabelRt("TO",8) + ":+".


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
   disp-site[1]     at 22        no-label
   disp-cost-set[1] at 32        no-label
   disp-site[2]     at 57        no-label
   disp-cost-set[2] at 67        no-label
   site       colon 20              label {&cscscpa_p_8}
   fromset                       no-label
   site1      colon 55              label {t001.i}
   toset                         no-label skip(1)
   part       colon 20   part1      label {t001.i} colon 55 skip
   line       colon 20   line1      label {t001.i} colon 55 skip
   type       colon 20   type1      label {t001.i} colon 55 skip
   ptgp       colon 20   ptgp1      label {t001.i} colon 55 skip
   clss       colon 20   clss1      label {t001.i} colon 55 skip
   pmcd       colon 20   pmcd1      label {t001.i} colon 55 skip
   ptby       colon 20   ptby1      label {t001.i} colon 55 skip
   disp-pct-change-allowed to 21 no-label negtol no-label
   disp-to-col             to 56 no-label postol no-label skip(1)
   mtl_flag   colon 30
   lbr_flag   colon 30
   bdn_flag   colon 30
   ovh_flag   colon 30
   sub_flag   colon 30
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
 FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME

/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

for first icc_ctrl
   fields(icc_cur_set icc_gl_set)
no-lock:
end.

assign
   postol = 9999.9
   negtol = -99.9
   glxcst = 0
   curcst = 100000.

/* mainloop:                                                                */
/* repeat:                                                                  */
/*    if part1  = hi_char then part1  = "".                                 */
/*    if line1  = hi_char then line1  = "".                                 */
/*    if type1  = hi_char then type1  = "".                                 */
/*    if ptgp1  = hi_char then ptgp1  = "".                                 */
/*    if clss1  = hi_char then clss1  = "".                                 */
/*    if pmcd1  = hi_char then pmcd1  = "".                                 */
/*    if ptby1  = hi_char then ptby1  = "".                                 */
/*    if negtol < 0       then negtol = - negtol.                           */
/*   if not batchrun then do:                                               */
/*       loopa:                                                             */
/*       do transaction with frame a on error undo, retry:                  */
/*          display disp-site                                               */
/*             disp-cost-set                                                */
/*             disp-pct-change-allowed                                      */
/*             disp-to-col with frame a.                                    */
/*          prompt-for site                                                 */
/*             fromset when (transtype begins "CS")                         */
/*             site1   when (transtype begins "CS")                         */
/*             toset   when (transtype begins "CS")                         */
/*          with frame a.                                                   */
/*                                                                          */
/*          for first si_mstr                                               */
/*             fields(si_cur_set si_db si_entity si_gl_set si_site)         */
/*             where si_site = input site no-lock:                          */
/*          end.                                                            */
/*                                                                          */
/*          if not available si_mstr                                        */
/*          then do:                                                        */
/*             /*SITE DOES NOT EXIST*/                                      */
/*             {pxmsg.i &MSGNUM=708 &ERRORLEVEL=3}                          */
/*             next-prompt site.                                            */
/*             undo loopa, retry.                                           */
/*          end.                                                            */
/*                                                                          */
/*          if si_db <> global_db                                           */
/*          then do:                                                        */
/*             /*SITE IS NOT ASSIGNED TO THIS DATABASE*/                    */
/*             {pxmsg.i &MSGNUM=5421 &ERRORLEVEL=3}                         */
/*             undo loopa, retry.                                           */
/*          end.                                                            */
/*                                                                          */
/*          {gprun.i ""gpsiver.p"" "(input  si_site,                        */
/*               input  recid(si_mstr),                                     */
/*               output return_int)"}                                       */
/*          if return_int = 0                                               */
/*          then do:                                                        */
/*             /* USER DOES NOT HAVE ACCESS TO SITE */                      */
/*             {pxmsg.i &MSGNUM=725 &ERRORLEVEL=3}                          */
/*             next-prompt site with frame a.                               */
/*             undo loopa, retry.                                           */
/*          end.                                                            */
/*                                                                          */
/*          if transtype = "PP01"                                           */
/*          then do:      /*FROM Current TO GL*/                            */
/*             if si_cur_set <> ""                                          */
/*                then                                                      */
/*                fromset = si_cur_set.                                     */
/*             else                                                         */
/*                fromset = icc_cur_set.                                    */
/*             if si_gl_set <> ""                                           */
/*                then                                                      */
/*                toset = si_gl_set.                                        */
/*             else                                                         */
/*                toset = icc_gl_set.                                       */
/*                                                                          */
/*             site1   = input site.                                        */
/*                                                                          */
/*             display                                                      */
/*                fromset                                                   */
/*                site1                                                     */
/*                toset                                                     */
/*             with frame a.                                                */
/*                                                                          */
/*          end.                                                            */
/*          else                                                            */
/*          if transtype = "PP02"                                           */
/*          then do:   /*from GL to Current*/                               */
/*             if si_gl_set <> ""                                           */
/*                then                                                      */
/*                fromset = si_gl_set.                                      */
/*             else                                                         */
/*                fromset = icc_gl_set.                                     */
/*             if si_cur_set <> ""                                          */
/*                then                                                      */
/*                toset = si_cur_set.                                       */
/*             else                                                         */
/*                toset = icc_cur_set.                                      */
/*             site1 = input site.                                          */
/*                                                                          */
/*             display                                                      */
/*                fromset                                                   */
/*                site1                                                     */
/*                toset                                                     */
/*             with frame a.                                                */
/*                                                                          */
/*          end.                                                            */
/*                                                                          */
/*          else                                                            */
/*          if transtype begins "CS"                                        */
/*          then do:                                                        */
/*             if input fromset = ""                                        */
/*             then do:                                                     */
/*                /*BLANK NOT ALLOWED*/                                     */
/*                {pxmsg.i &MSGNUM=40 &ERRORLEVEL=3}                        */
/*                next-prompt fromset.                                      */
/*                undo loopa, retry.                                        */
/*             end.                                                         */
/*                                                                          */
/*             if not can-find(cs_mstr                                      */
/*                where cs_set = input fromset)                             */
/*             then do:                                                     */
/*                /*COST SET DOES NOT EXIST*/                               */
/*                {pxmsg.i &MSGNUM=5407 &ERRORLEVEL=3}                      */
/*                next-prompt fromset.                                      */
/*                undo loopa, retry.                                        */
/*             end.                                                         */
/*                                                                          */
/*             if transtype = "CSSIM"                                       */
/*             then do:                                                     */
/*                if not can-find(first cs_mstr                             */
/*                   where cs_set  = input fromset                          */
/*                   and   cs_type = "SIM" )                                */
/*                then do:                                                  */
/*                   /*NOT A SIMULATION COST SET*/                          */
/*                   {pxmsg.i &MSGNUM=5405 &ERRORLEVEL=3}                   */
/*                   next-prompt fromset.                                   */
/*                   undo loopa, retry.                                     */
/*                end.                                                      */
/*             end.                                                         */
/*             else                                                         */
/*             if transtype = "CSCOST"                                      */
/*             then do:                                                     */
/*                if can-find(first cs_mstr                                 */
/*                   where cs_set  = input fromset                          */
/*                   and   cs_type = "SIM" )                                */
/*                then do:                                                  */
/*                   /*SIMULATION COST SET*/                                */
/*                   {pxmsg.i &MSGNUM=5428 &ERRORLEVEL=3}                   */
/*                   next-prompt fromset.                                   */
/*                   undo loopa, retry.                                     */
/*                end.                                                      */
/*             end.                                                         */
/*                                                                          */
/*             for first si_mstr                                            */
/*                fields(si_cur_set si_db si_entity si_gl_set si_site)      */
/*                where si_site = input site1                               */
/*             no-lock:                                                     */
/*             end.                                                         */
/*                                                                          */
/*             if not available si_mstr                                     */
/*             then do:                                                     */
/*                /*SITE DOES NOT EXIST*/                                   */
/*                {pxmsg.i &MSGNUM=708 &ERRORLEVEL=3}                       */
/*                next-prompt site1.                                        */
/*                undo loopa, retry.                                        */
/*             end.                                                         */
/*                                                                          */
/*             if si_db <> global_db                                        */
/*             then do:                                                     */
/*                /*SITE IS NOT ASSIGNED TO THIS DATABASE*/                 */
/*                {pxmsg.i &MSGNUM=5421 &ERRORLEVEL=3}                      */
/*                next-prompt site1.                                        */
/*                undo loopa, retry.                                        */
/*             end.                                                         */
/*                                                                          */
/*             {gprun.i ""gpsiver.p"" "(input  si_site,                     */
/*                  input  recid(si_mstr),                                  */
/*                  output return_int)"}                                    */
/*             if return_int = 0                                            */
/*             then do:                                                     */
/*                /* USER DOES NOT HAVE ACCESS TO SITE */                   */
/*                {pxmsg.i &MSGNUM=725 &ERRORLEVEL=3}                       */
/*                next-prompt site1 with frame a.                           */
/*                undo loopa, retry.                                        */
/*             end.                                                         */
/*                                                                          */
/*             if input toset = ""                                          */
/*             then do:                                                     */
/*                /*BLANK NOT ALLOWED*/                                     */
/*                {pxmsg.i &MSGNUM=40 &ERRORLEVEL=3}                        */
/*                next-prompt toset.                                        */
/*                undo loopa, retry.                                        */
/*             end.                                                         */
/*                                                                          */
/*             if not can-find(cs_mstr                                      */
/*                where cs_set = input toset)                               */
/*             then do:                                                     */
/*                /*COST SET DOES NOT EXIST*/                               */
/*                {pxmsg.i &MSGNUM=5407 &ERRORLEVEL=3}                      */
/*                next-prompt toset.                                        */
/*                undo loopa, retry.                                        */
/*             end.                                                         */
/*                                                                          */
/*             if transtype = "CSSIM"                                       */
/*             then do:                                                     */
/*                if not can-find(first cs_mstr                             */
/*                   where cs_set  = input toset                            */
/*                   and   cs_type = "SIM" )                                */
/*                then do:                                                  */
/*                   /*NOT A SIMULATION COST SET*/                          */
/*                   {pxmsg.i &MSGNUM=5405 &ERRORLEVEL=3}                   */
/*                   next-prompt toset.                                     */
/*                   undo loopa, retry.                                     */
/*                end.                                                      */
/*             end.                                                         */
/*             else                                                         */
/*             if transtype = "CSCOST"                                      */
/*             then do:                                                     */
/*                if can-find(first cs_mstr                                 */
/*                   where cs_set  = input toset                            */
/*                   and   cs_type = "SIM" )                                */
/*                then do:                                                  */
/*                   /*SIMULATION COST SET*/                                */
/*                   {pxmsg.i &MSGNUM=5428 &ERRORLEVEL=3}                   */
/*                   next-prompt toset.                                     */
/*                   undo loopa, retry.                                     */
/*                end.                                                      */
/*             end.                                                         */
/*          end.                                                            */
/*                                                                          */
/*          for first cs_mstr                                               */
/*             fields(cs_method cs_set cs_type)                             */
/*             where cs_set = input toset                                   */
/*          no-lock:                                                        */
/*          end.                                                            */
/*                                                                          */
/*          if cs_method = "AVG"                                            */
/*             then do i = 1 to 5:                                          */
/*             for first sc_mstr                                            */
/*                fields(sc_category sc_sim)                                */
/*                where sc_sim      = input fromset                         */
/*                and   sc_category = string(i)                             */
/*             no-lock:                                                     */
/*             end.                                                         */
/*                                                                          */
/*             if ambiguous sc_mstr                                         */
/*             then do:                                                     */
/*                {pxmsg.i &MSGNUM=5311                                     */
/*                   &ERRORLEVEL=4                                          */
/*                   &MSGARG1=usr_val[i]                                    */
/*                   &MSGARG2=disp-msg}                                     */
/*                next-prompt fromset.                                      */
/*                undo loopa, retry.                                        */
/*             end.                                                         */
/*          end.                                                            */
/*                                                                          */
/*          /* SECTION ADDED TO VERIFY GL IS OPEN */                        */
/*          /* CHECK FOR WRONG OR INVALID PERIOD */                         */
/*                                                                          */
/*          for first cs_mstr                                               */
/*             fields(cs_method cs_set cs_type)                             */
/*             where cs_set = input toset                                   */
/*          no-lock:                                                        */
/*          end.                                                            */
/*                                                                          */
/*          if cs_type = 'gl'                                               */
/*          then do:                                                        */
/*             assign                                                       */
/*                gl_trans_type = "IC"                                      */
/*                gl_trans_ent  = si_entity                                 */
/*                gl_effdt_date = today.                                    */
/*                                                                          */
/*             /* SECOND PARAMETER CHANGED FROM glentity TO gl_trans_ent */ */
/*             {gprun.i ""gpglef.p"" "(input gl_trans_type,                 */
/*                  input gl_trans_ent,                                     */
/*                  input gl_effdt_date,                                    */
/*                  input  1,                                               */
/*                  output gpglef)" }                                       */
/*             if gpglef > 0                                                */
/*             then do:                                                     */
/*                next-prompt toset.                                        */
/*                undo loopa, retry.                                        */
/*             end.                                                         */
/*          end.  /* END OF CODE ADDED TO VERIFY GL IS OPEN */              */
/*       end.  /*loopa*/                                                    */
/*                                                                          */
/*       assign                                                             */
/*          fromset                                                         */
/*          toset                                                           */
/*          site                                                            */
/*          site1.                                                          */
/*                                                                          */
/*       update                                                             */
/*          part                                                            */
/*          part1                                                           */
/*          line                                                            */
/*          line1                                                           */
/*          type                                                            */
/*          type1                                                           */
/*          ptgp                                                            */
/*          ptgp1                                                           */
/*          clss                                                            */
/*          clss1                                                           */
/*          pmcd                                                            */
/*          pmcd1                                                           */
/*          ptby                                                            */
/*          ptby1                                                           */
/*          negtol                                                          */
/*          postol                                                          */
/*          mtl_flag                                                        */
/*          lbr_flag                                                        */
/*          bdn_flag                                                        */
/*          ovh_flag                                                        */
/*          sub_flag                                                        */
/*       with frame a.                                                      */
/*    end. /*if not batch_run*/                                             */
/*                                                                          */
/*    else do on error undo, retry:                                         */
/*       update                                                             */
/*          site                                                            */
/*          fromset                                                         */
/*          site1                                                           */
/*          toset                                                           */
/*          part                                                            */
/*          part1                                                           */
/*          line                                                            */
/*          line1                                                           */
/*          type                                                            */
/*          type1                                                           */
/*          ptgp                                                            */
/*          ptgp1                                                           */
/*          clss                                                            */
/*          clss1                                                           */
/*          pmcd                                                            */
/*          pmcd1                                                           */
/*          ptby                                                            */
/*          ptby1                                                           */
/*          negtol                                                          */
/*          postol                                                          */
/*          mtl_flag                                                        */
/*          lbr_flag                                                        */
/*          bdn_flag                                                        */
/*          ovh_flag                                                        */
/*          sub_flag                                                        */
/*       with frame a.                                                      */
/*    end.                                                                  */
/*                                                                          */
/*    run quote-vars.                                                       */
/*                                                                          */
/*    if part1  = "" then part1  = hi_char.                                 */
/*    if line1  = "" then line1  = hi_char.                                 */
/*    if type1  = "" then type1  = hi_char.                                 */
/*    if ptgp1  = "" then ptgp1  = hi_char.                                 */
/*    if clss1  = "" then clss1  = hi_char.                                 */
/*    if pmcd1  = "" then pmcd1  = hi_char.                                 */
/*    if ptby1  = "" then ptby1  = hi_char.                                 */
/*    if negtol > 0  then negtol = - negtol.                                */
/*                                                                          */
/*    /* CURRENT COST SET MOVE TO GL SET (1.4.22) AND                 */    */
/*    /* GL COST SET MOVE TO CURRENT SET (1.4.23) USE ACTIVE COST SETS.*/   */
/*    /* FOR LINKED TARGET SITES (SITE-ITEM LINKED TO SOURCE SITE) THE */   */
/*    /* GL COSTS AT THAT SITE ARE NOT ACTIVE.                         */   */
/*    /* THEREFORE WE WILL NOT MOVE GL COSTS FROM or TO LINKED TARGET  */   */
/*    /* SITES.                                                        */   */
/*    /* FOR THESE MENU ITEMS FROM (site) AND TO SITE (site1) ARE SAME.*/   */
/*    if not batchrun then do:                                              */
/*       /* FROM CURRENT TO GL */                                           */
/*       if (transtype = "PP01") and                                        */
/*          (can-find (first in_mstr where in_site = site1                  */
/*          and in_part >= part and in_part <= part1                        */
/*          and in_site <> in_gl_cost_site))                                */
/*       then do:                                                           */
/*          {pxmsg.i &MSGNUM=4075 &ERRORLEVEL=2}                            */
/*          /* ACTIVE GL COSTS WILL BE UPDATED ONLY AT GL SOURCE SITE*/     */
/*       end. /* IF TRANSTYPE = "PP01" and ... */                           */
/*                                                                          */
/*       /* FROM GL TO CURRENT */                                           */
/*       if (transtype = "PP02") and                                        */
/*          (can-find (first in_mstr where in_site = site                   */
/*          and in_part >= part and in_part <= part1                        */
/*          and in_site <> in_gl_cost_site))                                */
/*       then do:                                                           */
/*          {pxmsg.i &MSGNUM=4141 &ERRORLEVEL=2 }                           */
/*          /* ACTIVE GL COSTS FROM LINKED SITES WILL NOT BE USED */        */
/*       end. /* IF TRANSTYPE = "PP02" and ... */                           */
/*    end. /* IF NOT BATCHRUN */                                            */

   ASSIGN part  = ""  part1  = hi_char
          line  = ""  line1  = hi_char
          type  = ""  type1  = hi_char
          ptgp  = ""  ptgp1  = hi_char
          clss  = ""  clss1  = hi_char
          pmcd  = ""  pmcd1  = hi_char
          ptby  = ""  ptby1  = hi_char
   .

   DISP site fromset site1 toset part part1 LINE line1 TYPE type1 ptgp ptgp1 
        clss clss1 pmcd pmcd1 ptby ptby1 mtl_flag lbr_flag bdn_flag 
   WITH FRAME a.
   
   backupset = STRING(YEAR(TODAY),"9999") + "-" + STRING(MONTH(TODAY),"99").

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType                = "hk"
      &printWidth               = 132
      &pagedFlag                = " "
      &stream                   = " "
      &appendToFile             = "append"
      &streamedOutputToTerminal = "yes"
      &withBatchOption          = "yes"
      &displayStatementType     = 1
      &withCancelMessage        = "yes"
      &pageBottomMargin         = 6
      &withEmail                = "yes"
      &withWinprint             = "yes"
      &defineVariables          = "yes"}
   RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   {mfphead.i}

  PUT "510 standard -> 500 backup " + backupset FORMAT "X(80)" AT 2.
  ASSIGN 
     site    = "510"
     site1   = "500"
     fromset = "standard"
     toset   = backupset
     pmcd    = "P"
     pmcd1   = "P"
/*      part    = "101-0603100" */
/*      part1   = "101-0603100" */
     mtl_flag = YES
  .
  {gprun.i ""cscscpb.p""}
  PUT "Hk-End-of-Copy " FORMAT "X(80)" AT 2. 

  PUT "500 standard -> 500 backup " + backupset FORMAT "X(80)" AT 2 .
  ASSIGN 
     site    = "500"
     site1   = "500"
     fromset = "standard"
     toset   = backupset
     pmcd    = "P"
     pmcd1   = "P"
/*      part    = "101-0603100"  */
/*      part1   = "101-0603100"  */
     mtl_flag = YES
  .
  {gprun.i ""cscscpb.p""}
  PUT "Hk-End-of-Copy " FORMAT "X(80)" AT 2. 

  PUT "510 current -> 500 standard " FORMAT "X(80)" AT 2.
  ASSIGN 
     site    = "510"
     site1   = "500"
     fromset = "current"
     toset   = "standard"
     pmcd    = "P"
     pmcd1   = "P"
/*      part    = "101-0603100"  */
/*      part1   = "101-0603100"  */
     mtl_flag = YES
  .
  {gprun.i ""cscscpb.p""}
  PUT "Hk-End-of-Copy " FORMAT "X(80)" AT 2. 

  PUT "500 current -> 500 standard " FORMAT "X(80)" AT 2.
  ASSIGN
     site    = "500"
     site1   = "500"
     fromset = "current"
     toset   = "standard"
     pmcd    = "P"
     pmcd1   = "P"
/*      part    = "101-0010101"  */
/*      part1   = "101-0010101"  */
     mtl_flag = YES
  .
  {gprun.i ""cscscpb.p""}
  PUT "Hk-End-of-Copy " FORMAT "X(80)" AT 2. 
   
  {mfrtrail.i} 

/*end.*/

